package com.guaoran.source.mybatis.v2.plugin;

import com.guaoran.source.mybatis.v2.config.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : 孤傲然
 * @Description :
 * @date :2018/5/27 7:35
 */
public class InterceptorChain {
    public static final List<Interceptor> interceptors = new ArrayList<Interceptor>();
    public void addInterceptor(Interceptor interceptor) {
        interceptors.add(interceptor);
    }
    public Object pluginAll(Object target) {
        for (Interceptor interceptor : interceptors) {
            target = interceptor.plugin(target);
        }
        return target;
    }
}
